package ae.pcfc.etks.online.web.util.token;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * Added to stop multiple submission on EHS New Requests
 * @author Essbc.Farhan (Usman Naveed)
 *
 */

public class SessionToken implements Serializable
{

	/**
	 * 
	 */
	private static final long serialVersionUID = -5568171325930437496L;
	
	private Map<String, Boolean> tokens = new HashMap<String, Boolean>(); 

	public synchronized boolean isTokenExist(String clazzName) 
	{
		if(tokens.containsKey(clazzName))
		{
			return false;
		}
		else
		{
			tokens.put(clazzName, new Boolean(true));
			return true;
		}
	}

	public void resetToken(String clazzName) 
	{		
		this.tokens.remove(clazzName);
	}
	
	
}
